module.exports = {
	props:{
		name: String,
		value: String,
		config:  {type: Object, default: {}}
	},
	data: function(){
		var _this = this;
		var config = {
			upload_url: "/file/we_upload/upload?dir=file",
			filelist_url: "/file/we_upload/filelist?dir=file",
		}
		return {
			thisconfig: $.merge(config,this.config),
		}
	},
	methods: {
		sync_html: function(){
			this.$emit('update:value', this.editor.html());
		}
	},
	mounted: function(){
		this.editor = new $.Editor(this.$refs.editor, this.thisconfig);
	},
	template: `<div class="editor-outer box" >
		<textarea class="editor-inner" ref="editor" spellcheck="false" :name="name" :value="value"></textarea>
	</div>
	`,
	updated: function(){
		this.editor.updateHtml();
		this.editor.lastRow();
	}
}
